from anyio import open_file
from fastapi import APIRouter
from fastapi.responses import HTMLResponse

router = APIRouter()


@router.get(path="/", summary="主页", response_class=HTMLResponse)
@router.get(path="/index", summary="主页", response_class=HTMLResponse)
@router.get(path="/index.html", summary="主页", response_class=HTMLResponse)
async def root():
	async with await open_file("static/index.html", "r", encoding="utf-8") as f:
		contents = await f.read()
	return HTMLResponse(contents)
